

package org.ing.sisval.gui.control.model;

import java.util.ArrayList;
import javax.swing.AbstractListModel;


public class ModeloLista extends AbstractListModel{    
    private ArrayList<String> list;
    public ModeloLista() {
        list= new ArrayList<String>();
    }
    
    @Override
    public int getSize() { return list.size(); }
    @Override
    public Object getElementAt(int i) { return list.get(i); }
    public ArrayList<String> getList(){
        return list;
    }
    public void addAll(ArrayList<String> list){
        this.list.clear();
        this.list.addAll(list);
        
    }
    public void add(String item){
        if (!list.contains(item)) {
            this.list.add(item);
        }        
    }
    public String get(int index){
        return this.list.get(index);
    }
    public void remove(int index){
        this.list.remove(index);
    }
    public void clear(){
        this.list.clear();
    }
    
}
